/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "ferias")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ferias.findAll", query = "SELECT f FROM Ferias f"),
    @NamedQuery(name = "Ferias.findByIdFerias", query = "SELECT f FROM Ferias f WHERE f.idFerias = :idFerias"),
    @NamedQuery(name = "Ferias.findByAno", query = "SELECT f FROM Ferias f WHERE f.ano = :ano"),
    @NamedQuery(name = "Ferias.findByDataInicial", query = "SELECT f FROM Ferias f WHERE f.dataInicial = :dataInicial"),
    @NamedQuery(name = "Ferias.findByDataFinal", query = "SELECT f FROM Ferias f WHERE f.dataFinal = :dataFinal"),
    @NamedQuery(name = "Ferias.findByEstado", query = "SELECT f FROM Ferias f WHERE f.estado = :estado")})
public class Ferias implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "dataInicial")
    @Temporal(TemporalType.DATE)
    private Date dataInicial;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dataFinal")
    @Temporal(TemporalType.DATE)
    private Date dataFinal;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idFerias")
    private Integer idFerias;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ano")
    private int ano;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "estado")
    private String estado;
    @JoinColumn(name = "fkContrato", referencedColumnName = "idContrato")
    @ManyToOne(optional = false)
    private Contrato fkContrato;

    public Ferias() {
    }

    public Ferias(Integer idFerias) {
        this.idFerias = idFerias;
    }

    public Ferias(Integer idFerias, int ano, Date dataInicial, Date dataFinal, String estado) {
        this.idFerias = idFerias;
        this.ano = ano;
        this.dataInicial = dataInicial;
        this.dataFinal = dataFinal;
        this.estado = estado;
    }

    public Integer getIdFerias() {
        return idFerias;
    }

    public void setIdFerias(Integer idFerias) {
        this.idFerias = idFerias;
    }

    public int getAno() {
        return ano;
    }

    public void setAno(int ano) {
        this.ano = ano;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Contrato getFkContrato() {
        return fkContrato;
    }

    public void setFkContrato(Contrato fkContrato) {
        this.fkContrato = fkContrato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFerias != null ? idFerias.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ferias)) {
            return false;
        }
        Ferias other = (Ferias) object;
        if ((this.idFerias == null && other.idFerias != null) || (this.idFerias != null && !this.idFerias.equals(other.idFerias))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Ferias[ idFerias=" + idFerias + " ]";
    }

    public Date getDataInicial() {
        return dataInicial;
    }

    public void setDataInicial(Date dataInicial) {
        this.dataInicial = dataInicial;
    }

    public Date getDataFinal() {
        return dataFinal;
    }

    public void setDataFinal(Date dataFinal) {
        this.dataFinal = dataFinal;
    }
    
}
